package com.gitee.wsl.mathematics.vector.ext

import com.gitee.wsl.mathematics.vector.vec2.Vector2
import com.gitee.wsl.mathematics.vector.vec3.Vector3
import com.gitee.wsl.mathematics.vector.vec4.Vector4

infix fun<T:Number,R:Vector2<T,R>> Vector2<T,*>.directionTo(other: Vector2<T,R>) = (other - this).normalized
infix fun<T:Number,R:Vector3<T,R>> Vector2<T,*>.directionTo(other: Vector3<T,R>) = (other - this).normalized
infix fun<T:Number,R:Vector4<T,R>> Vector2<T,*>.directionTo(other: Vector4<T,R>) = (other - this).normalized

infix fun<T:Number,V:Vector3<T,V>> Vector3<T,V>.directionTo(other: Vector2<T,*>) = (this - other).normalized
infix fun<T:Number,V:Vector3<T,V>> Vector3<T,V>.directionTo(other: Vector3<T,*>) = (this - other).normalized
infix fun<T:Number,R:Vector4<T,R>> Vector3<T,*>.directionTo(other: Vector4<T,R>) = (other - this).normalized

infix fun<T:Number,V:Vector4<T,V>> Vector4<T,V>.directionTo(other: Vector2<T,*>) = (this - other).normalized
infix fun<T:Number,V:Vector4<T,V>> Vector4<T,V>.directionTo(other: Vector3<T,*>) = (this - other).normalized
infix fun<T:Number,V:Vector4<T,V>> Vector4<T,V>.directionTo(other: Vector4<T,*>) = (this - other).normalized

